package org.diffgenova;

import java.io.File;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.view.Window;
import android.webkit.WebSettings;
import android.webkit.WebSettings.TextSize;
import android.webkit.WebView;
import android.widget.AutoCompleteTextView;
import android.widget.TextView;

public class WebViewActivity extends Activity {
    
    private TextView rifiutoText;

	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().requestFeature(Window.FEATURE_PROGRESS);
        setContentView(R.layout.webview);

        rifiutoText = (TextView) findViewById(R.id.show_rifiuto);

        WebView wv;
        
        wv = (WebView) findViewById(R.id.webview);
        wv.setClickable(true);
        wv.setNetworkAvailable(false);
        
        WebSettings settings = wv.getSettings();
        settings.setJavaScriptEnabled(false);
        settings.setBlockNetworkLoads(true);
        settings.setSupportZoom(true);
        settings.setBuiltInZoomControls(true);
        settings.setTextSize(TextSize.LARGEST);
        Bundle extras = getIntent().getExtras();
        String categoria = (String) extras.get("categoria");
        String rifiuto = (String) extras.get("rifiuto");
        setTitle(categoria);
        if(rifiuto != null){
        	rifiutoText.setText(rifiuto);
        	rifiutoText.setVisibility(View.VISIBLE);
        } else {
        	rifiutoText.setVisibility(View.INVISIBLE);
        }
        String urlHtml = "file:///android_asset/html/" + categoria + ".html";
		wv.loadUrl(urlHtml);
    }
    
}
